<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<c:set var="tourism" value="<%=request.getContextPath()%>"/>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Tourism</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" type="text/css" href="${tourism}/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="${tourism}/css/nprogress.css">
    <link rel="stylesheet" type="text/css" href="${tourism}/css/style.css">
    <link rel="stylesheet" type="text/css" href="${tourism}/css/font-awesome.min.css">
    <link rel="apple-touch-icon-precomposed" href="${tourism}/images/icon.png">
    <link rel="shortcut icon" href="${tourism}/images/favicon.ico">
    <script src="${tourism}/js/jquery-2.1.4.min.js"></script>
    <script src="${tourism}/js/jquery.lazyload.min.js"></script>

</head>
<body class="user-select">
<header class="header">
    <nav class="navbar navbar-default" id="navbar">
        <div class="container">
            <div class="header-topbar hidden-xs link-border">
                <!--<ul class="site-nav topmenu">
                  <li><a href="#" >标签云</a></li>
                    <li><a href="#" rel="nofollow" >读者墙</a></li>
                    <li><a href="#" title="RSS订阅" >
                        <i class="fa fa-rss">
                        </i> RSS订阅
                    </a></li>
                </ul>
                         勤记录 懂分享
                         -->
            </div>
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#header-navbar" aria-expanded="false"><span class="sr-only"></span> <span
                        class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
                <h1 class="logo hvr-bounce-in"><a href="#" title="牛江明网络博客"><img src="${tourism}/images/201610171329086541.png"
                                                                               alt="牛江明网络博客"></a></h1>
            </div>
            <div class="collapse navbar-collapse" id="header-navbar">
                <form class="navbar-form visible-xs" action="/Search" method="post">
                    <div class="input-group">
                        <input type="text" name="keyword" class="form-control" placeholder="请输入关键字" maxlength="20"
                               autocomplete="off">
                        <span class="input-group-btn">
		<button class="btn btn-default btn-search" name="search" type="submit">搜索</button>
		</span></div>
                </form>
                <ul class="nav navbar-nav navbar-right">
                    <li><a data-cont="牛江明网络博客" title="牛江明网络博客" href="${tourism}/">首页</a></li>
                    <li>
                        <c:if test="${sessionScope.get('USERNAME')!=null}">
                            <a data-cont="列表页" title="列表页" href="#">${sessionScope.get('USERNAME').username}
                                用户,你好
                            </a>
                        </c:if>
                        <c:if test="${sessionScope.get('USERNAME')==null}">
                            <a data-cont="列表页" title="列表页" href="${tourism}/login">登陆</a>
                        </c:if>
                    </li>
                    <c:if test="${sessionScope.get('USERNAME')!=null}">
                        <li>
                            <a id="logout">注销</a>
                        </li>
                    </c:if>
                    <%--<li><a data-cont="详细页" title="详细页" href="show.html">详细页</a></li>--%>
                </ul>
            </div>
        </div>
    </nav>
</header>
<section class="container">
    <div class="content-wrap">
        <div class="content">
            <div id="focusslide" class="carousel slide" data-ride="carousel">
                <ol class="carousel-indicators">
                    <li data-target="#focusslide" data-slide-to="0" class="active"></li>
                    <li data-target="#focusslide" data-slide-to="1"></li>
                </ol>
                <div class="carousel-inner" role="listbox">
                    <div class="item active">
                        <a href="#" target="_blank" title="牛江明网络博客">
                            <img src="${tourism}/images/201610181557196870.jpg" alt="牛江明网络博客" class="img-responsive"></a>
                    </div>
                    <div class="item">
                        <a href="#" target="_blank" title="专业网站建设">
                            <img src="${tourism}/images/201610241227558789.jpg" alt="专业网站建设" class="img-responsive"></a>
                    </div>
                </div>

                <a class="left carousel-control" href="#focusslide" role="button" data-slide="prev" rel="nofollow">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span
                        class="sr-only">上一个</span> </a> <a class="right carousel-control" href="#focusslide"
                                                           role="button" data-slide="next" rel="nofollow"> <span
                    class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span
                    class="sr-only">下一个</span> </a></div>
            <div class="title">
                <h3>景点排行</h3>
                <div class="more">
                    <%--<a href="#" title="MZ-NetBlog主题" >MZ-NetBlog主题</a>
                    <a href="#" title="IT技术笔记" >IT技术笔记</a>
                    <a href="#" title="源码分享" >源码分享</a>
                    <a href="#" title="靠谱网赚" >靠谱网赚</a>--%>
                    <a href="#" title="资讯分享">资讯分享</a>
                </div>
            </div>
            <div id="articleContent">
                <%--<article  class="excerpt excerpt-1" style="">
                    <a class="focus" href="#" title="用DTcms做一个独立博客网站（响应式模板）" target="_blank" >
                        <img class="thumb" data-original="images/201610181739277776.jpg" src="images/201610181739277776.jpg" alt="用DTcms做一个独立博客网站（响应式模板）"  style="display: inline;">
                    </a>
                    <header>
                        <a class="cat" href="#" title="top1" >top1</a>
                        <h2>
                            <a href="http://localhost/tourism/show" title="景点景点景点景点景点1" target="_blank" >景点景点景点景点景点1</a>
                        </h2>
                    </header>
                    <p class="meta">
                        <time class="time"><i class="glyphicon glyphicon-hand-right"></i> 推荐数:111</time>
                        <span class="views"><i class="glyphicon glyphicon-comment"></i> 216</span>
                    </p>
                    <p class="note" >大沙发发山东省的发士大夫发送到大夫山大三大沙发发山东省的发士大夫发送到大夫山大三大沙发发山东省的发士大夫发送到大夫山大三大沙发发山东省的发士大夫发送到大夫山大三大沙发发山东省的发士大夫发送到大夫山大三大沙发发山东省的发士大夫发送到大夫山大三</p>
                </article>--%>
            </div>
            <div class="ias_trigger" style="" id="lookmore"><a href="javascript:;">查看更多</a></div>
        </div>
    </div>
    <div class="tlinks">Collect from <a href="http://www.cssmoban.com/">企业网站模板</a></div>
    <aside class="sidebar">
        <div class="fixed">
            <div class="widget widget-tabs">
                <ul class="nav nav-tabs" role="tablist">
                    <li role="presentation" class="active"><a href="#notice" aria-controls="notice" role="tab"
                                                              data-toggle="tab">统计信息</a></li>
                    <li role="presentation"><a href="#contact" aria-controls="contact" role="tab"
                                               data-toggle="tab">联系站长</a></li>
                </ul>
                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane contact active" id="notice">
                        <h2>
                            <div style="float: left;margin-left: 10px">日志总数:</div>
                            888篇
                        </h2>
                        <h2>
                            <div style="float: left;margin-left: 10px">网站运行:</div>
                            <span id="sitetime">88天 </span>
                        </h2>
                    </div>
                    <div role="tabpanel" class="tab-pane contact" id="contact">
                        <h2>
                            <div style="float: left;margin-left: 10px">QQ:</div>
                            <a href="" target="_blank" rel="nofollow" data-toggle="tooltip" data-placement="bottom"
                               title="" data-original-title="123456789">123456789</a>
                        </h2>
                        <h2>
                            <div style="float: left;margin-left: 10px">Email:</div>
                            <a href="#" target="_blank" data-toggle="tooltip" rel="nofollow" data-placement="bottom"
                               title="" data-original-title="123456789">123456789@qq.com</a></h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="widget widget_hot">
            <h3>最新评论</h3>
            <ul id="newView">
                <%--<li>
                    <a title="景点景点景点111" href="http://localhost/tourism/show">
                        <span class="thumbnail" style="margin-right: 20px;">
                            <img class="thumb" data-original="images/201610181739277776.jpg"
                                 src="images/201610181739277776.jpg" alt="用DTcms做一个独立博客网站（响应式模板）"
                                 style="display: block;">
			            </span>
                        <span class="text" style="margin-top: 15px;margin-bottom: 13px;">景点景点景点111</span>
                        <span class="muted">
                          <i class="glyphicon glyphicon-time"></i>2019-3-22
			            </span>
                        <span class="muted"><i class="glyphicon glyphicon-comment"></i> 216</span></a>
                </li>--%>
            </ul>
        </div>
        <div class="widget widget_sentence">
            <h3>友情链接</h3>
            <div class="widget-sentence-link">
                <a href="#" title="大众点评" target="_blank">大众点评</a>&nbsp;&nbsp;&nbsp;
            </div>
        </div>
    </aside>
</section>
<footer class="footer">
    <div class="container">
        <p>旅游信息分享系统</p>
    </div>
    <div id="gotop"><a class="gotop"></a></div>
</footer>
<script src="${tourism}/js/bootstrap.min.js"></script>
<script src="${tourism}/js/jquery.ias.js"></script>
<script src="${tourism}/js/scripts.js"></script>
</body>
<script>
    $(function () {
        $.ajax({
            url: '${tourism}/scenicSpot/queryAll',
            type: 'POST',
            cache: false,
            contentType: false,
            success: function (data) {
                /*console.log(data);*/
                var arr = ["*****", "****", "****", "***"];
                for (var i = 0; i < data.data.length & i < 4; i++) {
                    $("#articleContent").append(
                        "<article  class='excerpt excerpt-1'>" +
                        "<a class='focus' href='${tourism}/show?id="+data.data[i].id+"' title='" + data.data[i].scenicName + "' target='_blank' >" +
                        "<img class='thumb' data-original='${tourism}/" + data.data[i].scenicImgUrl + "' src='${tourism}/" + data.data[i].scenicImgUrl + "' alt='${tourism}/" + data.data[i].scenicImgUrl + "'  style='display: inline;'>" +
                        "</a>" + "<header>" +
                        "<a class='cat' href='${tourism}/show?id="+data.data[i].id+"' title='top1' >top" + (i + 1) + "</a>" +
                        "<h2>" + "<a href='${tourism}/show?id="+data.data[i].id+"' title='" + data.data[i].scenicName + "' target='_blank' >" + data.data[i].scenicName + "</a>" +
                        "</h2></header><p class='meta'><time class='time'><i class='glyphicon glyphicon-hand-right'></i> 推荐数:" + arr[i] + "</time>" +
                        "<span class='views'><i class='glyphicon glyphicon-comment'></i> " + data.data[i].view + "</span> </p>" +
                        "<p class='note' >" + data.data[i].scenicContent + "</p></article>"
                    );
                }
                /*console.log(data.data[0]);*/
            }
        });
        $("#lookmore").click(function () {
            $.ajax({
                url: '${tourism}/scenicSpot/queryAll',
                type: 'POST',
                cache: false,
                contentType: false,
                success: function (data) {
                    /*console.log(data);*/
                    $("#lookmore").remove();
                    var arr = ["*****", "****", "****", "***"];
                    for (var i = 0; i < data.data.length & i < 4; i++) {
                        $("#articleContent").append(
                            "<article  class='excerpt excerpt-1'>" +
                            "<a class='focus' href='${tourism}/show?id="+data.data[i].id+"' title='" + data.data[i].scenicName + "' target='_blank' >" +
                            "<img class='thumb' data-original='${tourism}/" + data.data[i].scenicImgUrl + "' src='${tourism}/" + data.data[i].scenicImgUrl + "' alt='${tourism}/" + data.data[i].scenicImgUrl + "'  style='display: inline;'>" +
                            "</a>" + "<header>" +
                            "<a class='cat' href='${tourism}/show?id="+data.data[i].id+"' title='top1' >top" + (i + 1) + "</a>" +
                            "<h2>" + "<a href='${tourism}/show?id="+data.data[i].id+"' title='" + data.data[i].scenicName + "' target='_blank' >" + data.data[i].scenicName + "</a>" +
                            "</h2></header><p class='meta'><time class='time'><i class='glyphicon glyphicon-hand-right'></i> 推荐数:" + arr[i] + "</time>" +
                            "<span class='views'><i class='glyphicon glyphicon-comment'></i> " + data.data[i].view + "</span> </p>" +
                            "<p class='note' >" + data.data[i].scenicContent + "</p></article>"
                        );
                    }
                    /*console.log(data.data[0]);*/
                }
        });});

        $.ajax({
            url: '${tourism}/scenicSpot/queryNewView',
            type: 'POST',
            cache: false,
            contentType: false,
            success: function (data) {
                for (var i = 0; i < data.data.length & i < 3; i++) {
                    var date = new Date(data.data[i].scenicOpenTime);
                    var Y=date.getFullYear();
                    var M=date.getMonth()+1;
                    var D=date.getDate();
                    date =Y+"-"+M+"-"+D;
                    $("#newView").append(
                        "<li>" +
                        "<a title='"+data.data[i].scenicName+"' href='${tourism}/show?id="+data.data[i].id+"'>" +
                        "<span class='thumbnail' style='margin-right: 20px;'>" +
                        "<img class='thumb' data-original='${tourism}/"+data.data[i].scenicImgUrl+"' src='${tourism}/"+data.data[i].scenicImgUrl+"' alt='用DTcms做一个独立博客网站（响应式模板）' style='display: block;'>" +
                        "</span>" +
                        "<span class='text' style='margin-top: 15px;margin-bottom: 13px;'>"+data.data[i].scenicName+"</span>" +
                        "<span class='muted'>" +
                        "<i class='glyphicon glyphicon-time'></i>"+date+"</span>" +
                        "<span class='muted'><i class='glyphicon glyphicon-comment'></i>"+data.data[i].view+"</span></a>" +
                        "</li>"
                    )
                }
            }
        });

        $("#logout").click(function () {
            $.ajax({
                url: '${tourism}/api/logout',
                type: 'POST',
                cache: false,
                success: function (data) {
                    console.log(data.data)
                    if(data.data){
                        window.location.reload();
                    }
                }
            });
        });
    });
</script>
</html>
